package itsur.arquitecturas.implicitinvocation;

/**************************************************************************************
** Class name: Displays
** Author: A.J. Lattanze
** Date: 12/29/99
** Version 1.0
***************************************************************************************
** Purpose: Assignment 3 for SE 17-655, Architectures for Software Systems.  This class
** will display lists (StudentList and CourseList objects).
** (reused from assignment 2)  
**
** Abstract: A variety of methods are provided that display Student object, Course 
** objects, StudentList objects, and CourseList objects to the terminal.  The methods 
** are in this class are as follows:
**
**	public void DisplayStudent( Student StudentObject ) - Displays a student object
**	elements as follows:
**
**		FirstName - Student's first name
**		LastName - Student's last name
**		StudentID - Student's social security number or ID number
**		Program - Student's program affiliation (e.g. MSE, HCI, GSIA)
**
**	Note that the courses taken by the student are not listed and the courses the 
**	student has registered for are not listed.  
**
**	public void DisplayCourse( Course CourseObject ) - Displays a course object
**	elements as follows:
**
**		CourseName - Course title
**		CourseID - Course number 
**		Section - Course section
**		Days - Days the course will be held on
**		StartTime - Start time of the course
**		StopTime - Stop time of the course
**		Instructor - Instructor Name
**
**	Note that the students registered for the course are not listed by this method.  
**
**	public void DisplayStudentsRegistered( Course CourseObject ) - This method lists
**	the students that have registered for the course (CourseObject).
**
**	public void DisplayStudentCoursesRegistered( Student StudentObject ) - This method
**	lists the courses that the student (StudentObject) has registered for.
**
**	public void DisplayStudentCoursesTaken( Student StudentObject ) - This method
**	lists the courses that the student (StudentObject) has taken.
**
**	public void DisplayStudentList( StudentList ListObject ) - Displays the students 
**	in the student list (ListObject).  Displays the same information that is listed 
**	in the DisplayStudent() method listed above.
**
**	public void DisplayCourseList( CourseList ListObject ) - Displays the courses
**	in the course list (ListObject).  Displays the same information that is listed
**	in the DisplayCourse() method listed above.
**
** Modification Log
**************************************************************************************
**
**************************************************************************************/

class Displays
{

	public void DisplayStudent( Student StudentObject )
	{
	   System.out.print( StudentObject.FirstName + " " + StudentObject.LastName + " " );
	   System.out.println( StudentObject.StudentID + " " + StudentObject.Program );

	} // DisplayStudent


	public void DisplayCourse( Course CourseObject )
	{
	   System.out.print( CourseObject.CourseName+ " " + CourseObject.CourseID+" ");
	   System.out.print( CourseObject.Section + " " + CourseObject.Days + " " );
	   System.out.print( CourseObject.StartTime + ":" + CourseObject.StopTime + " " );
	   System.out.println( CourseObject.Instructor );

	} // DisplayCourse


	public void DisplayStudentsRegistered( Course CourseObject )
	{
	   boolean Done;
	   Student StudentObject;

	   System.out.println( "\nStudents Registered For: " + " " );

   	   System.out.print( CourseObject.CourseName+ " " + CourseObject.CourseID+" ");
   	   System.out.print( CourseObject.Section + " " + CourseObject.Days + " " );
   	   System.out.print( CourseObject.StartTime + ":" + CourseObject.StopTime + " " );
   	   System.out.println( CourseObject.Instructor );

	   System.out.println( "===========================================================" );

	   CourseObject.Registered.GoToFrontOfList();	
	   Done = false;

	   while( !Done )
	   {
		StudentObject = CourseObject.Registered.GetNextStudent();

		if ( StudentObject == null )
		{
		   Done = true;

		} else {

		   DisplayStudent( StudentObject );
		 
		} // if
	   } // while

	} // DisplayStudentsRegistered


	public void DisplayStudentCoursesRegistered( Student StudentObject )
	{
	   boolean Done;
	   Course CourseObject;

	   System.out.print( "\nCourses Registered For: " + StudentObject.FirstName + " " );
	   System.out.println( StudentObject.LastName + " " + StudentObject.StudentID );
	   System.out.println( "==================================================== " );

	   StudentObject.CoursesRegistered.GoToFrontOfList();	
	   Done = false;

	   while( !Done )
	   {
		CourseObject = StudentObject.CoursesRegistered.GetNextCourse();

		if ( CourseObject == null )
		{
		   Done = true;

		} else {

		   DisplayCourse( CourseObject );
		 
		} // if
	   } // while
	} // DisplayStudentCoursesRegistered


	public void DisplayStudentCoursesTaken( Student StudentObject, CourseList ListObject)
	{
	   boolean Done;
	   Course CourseObject;

	   System.out.print( "\nCourses Taken: " + StudentObject.FirstName + " " );
	   System.out.println( StudentObject.LastName + " " + StudentObject.StudentID );
	   System.out.println( "================================================ " );

	   ListObject.GoToFrontOfList();
	  //StudentObject.CoursesTakenList.GoToFrontOfList();
	   Done = false;

	   while( !Done )
	   {
		   CourseObject = ListObject.GetNextCourse();
		  //CourseObject = StudentObject.CoursesTakenList.GetNextCourse();
		   
		if ( CourseObject == null )
		{
		   Done = true;

		} else {

	   	   System.out.println(CourseObject.CourseID + ":" + CourseObject.CourseName);

		} // if
	   } // while
	} // DisplayStudentCoursesTaken	


	public void DisplayStudentList( StudentList ListObject )
	{
	   boolean Done;
	   Student StudentObject;

	   System.out.print( "\n" );

	   ListObject.GoToFrontOfList();	

	   Done = false;

	   while( !Done )
	   {

		StudentObject = ListObject.GetNextStudent();

		if ( StudentObject == null )
		{
		   Done = true;

		} else {

		   DisplayStudent( StudentObject );

		} // if
	   } // while
	} // DisplayStudentList


	public void DisplayCourseList( CourseList ListObject )
	{
	   boolean Done;
	   Course CourseObject;

	   System.out.print( "\n" );

	   ListObject.GoToFrontOfList();	
	   Done = false;

	   while( !Done )
	   {
		CourseObject = ListObject.GetNextCourse();

		if ( CourseObject == null )
		{
		   Done = true;

		} else {

		   DisplayCourse( CourseObject );

		} // if
	   } // while
	} // DisplayCourseList

	
	//ITSUR
	public void DisplayStudentPendingCORECourses( Student StudentObject , CourseList ListObject )
	{
	   boolean Done;
	   Course CourseObject;

	   System.out.print( "\nCORE Courses Pending: " + StudentObject.FirstName + " " );
	   System.out.println( StudentObject.LastName + " " + StudentObject.StudentID );
	   System.out.println( "================================================ " );

	   ListObject.GoToFrontOfList();
	   Done = false;

	   while( !Done )
	   {
        CourseObject = ListObject.GetNextCourse();
		
		if ( CourseObject == null )
		{
		   Done = true;

		} else {
         			
	   	   System.out.println(CourseObject.CourseID + ":" + CourseObject.CourseName);

		} // if
	   } // while
	} // DisplayStudentPendingCORECourses
	
} // Displays